package com.xiachufang.app.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Res<T> {
    private Integer code;
    private String msg;
    private T data;

    public static <T> Res<T> success(T data) {
        return new Res<>(200, "", data);
    }

    public static <T> Res<T> success() {
        return new Res<>(200, "", null);
    }

    public static Res<?> error(String msg) {
        return new Res<>(500, msg, null);
    }
}
